package at.fhj.itm10.ticketmaster.models;

/**
*
* @author Benjamin Hirt
*/

public class Event implements Model{
	long id; 
	String name;
	String dateTime;
	int primeevent; 
	double ticketPrice;
	int ticketAmount;
	int eventCanceled;
	String description;
	String enter;
	String begin;
	String flyer;
	long fkAddressId;
	int fkCustomerId;
	int fkEventtypeId;

	public Event(long id, String name, String dateTime, int primeevent, 
			double ticketPrice, int ticketAmount, int eventCanceled, String description, 
			String enter, String begin, String flyer, int fkAddressId, int fkCustomerId,
			int fkEventtypeId) {
		setId(id);
		setName(name);
		setDateTime(dateTime);
		setPrimeevent(primeevent);
		setTicketAmount(ticketAmount);
		setTicketPrice(ticketPrice);
		setEventCanceled(eventCanceled);
		setDescription(description);
		setEnter(enter);
		setBegin(begin);
		setFlyer(flyer);
		setFkAddressId(fkAddressId);
		setFkCustomerId(fkCustomerId);
		setFkEventtypeId(fkEventtypeId);
	}

	public Event() {
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDateTime() {
		return dateTime;
	}
	
	// Ausgabe der einzelenen Elemente des Datums für event.xhtml
	
	public String getDateTimeHoursOnly() {
		
		String[] dateTimeHours = getEnter().split(" ");
		
		dateTimeHours[1] = dateTimeHours[1].substring(0, 5);
		System.out.println(dateTime);
		return dateTimeHours[1];
	}
	
	public String getDateTimeDateOnly() {
		
		String[] temp = dateTime.split(" ");
		String[] dateTimeDateArray = temp[0].split("-");
		String dateTimeDate = dateTimeDateArray[2] + "." + dateTimeDateArray[1] + "." + dateTimeDateArray[0];
		return dateTimeDate;
	}

	public void setDateTime(String dateTime) {
		this.dateTime = dateTime;
	}

	public int getPrimeevent() {
		return primeevent;
	}

	public void setPrimeevent(int primeevent) {
		this.primeevent = primeevent;
	}

	public double getTicketPrice() {
		return ticketPrice;
	}

	public void setTicketPrice(double ticketPrice) {
		this.ticketPrice = ticketPrice;
	}

	public int getTicketAmount() {
		return ticketAmount;
	}

	public void setTicketAmount(int ticketAmount) {
		this.ticketAmount = ticketAmount;
	}
	
	public int getEventCanceled() {
		return eventCanceled;
	}

	public void setEventCanceled(int eventCanceled) {
		this.eventCanceled = eventCanceled;
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getEnter() {
		return enter;
	}

	public void setEnter(String enter) {
		this.enter = enter;
	}

	public String getBegin() {
		return begin;
	}

	public void setBegin(String begin) {
		this.begin = begin;
	}

	public String getFlyer() {
		return flyer;
	}

	public void setFlyer(String flyer) {
		this.flyer = flyer;
	}

	public long getFkAddressId() {
		return fkAddressId;
	}

	public void setFkAddressId(long fkAdressId) {
		this.fkAddressId = fkAdressId;
	}

	public int getFkCustomerId() {
		return fkCustomerId;
	}

	public void setFkCustomerId(int fkCustomerId) {
		this.fkCustomerId = fkCustomerId;
	}

	public int getFkEventtypeId() {
		return fkEventtypeId;
	}

	public void setFkEventtypeId(int fkEventtypeId) {
		this.fkEventtypeId = fkEventtypeId;
	}

	@Override
	public String toString() {
		return "id = [" + getId() + "], Name = [" + getName() + "], Date&Time = [" + getDateTime() +"], " +
				"is PrimeEvent = [" + getPrimeevent() + "], " + "TicketPrice = [" + getTicketPrice() + "], " +
				"TicketAmount = [" + getTicketAmount() + "], " + "is EventCanceled = [" + getEventCanceled() +"], " +
				"Description = [" + getDescription() + "], " + "Enter = [" + getEnter() + "], " +
				"Begin = [" + getBegin() + "], " + "Flyer = [" + getFlyer() + "], " +
				"fkAddressId = [" + getFkAddressId() + "], " + "fkCustomerId = [" + getFkCustomerId() + "], " +
				"fkEventtypeId = [" + getFkEventtypeId() + "]";
	}
}
